


clear;







load('datamarketG2')



for j=1:length(ss)
s=ss(j);
betas=beta0+beta1*s; 
lambdas=max(lambda0*(1-zeta0*s^zeta1),0);
zetas=max(eta0*(1-s^eta1),0);
zetan2(j)=zetas;
ix=ixmk2(j);
x=xmk2(j);
phii=ix-etaI*ix^2/2-deltaI;
ellmk(j)=1/(betas+1);
lambdasmk2(j)=lambdas;
gxmk2(j)=phii-lambdas/(betas+1)-zetan(j)*(qx(j)-qxB(j))/qx(j);
end







dt=0.01;
T1=20;
t1=0:dt:T1;
nt1=length(t1);

nmk(1)=ss(1);


gnmk2=phiXmk2(1:flagstarmk2)-phiImk2(1:flagstarmk2);
for i=2:nt1
nmk(i)=nmk(i-1)+gnmk2(floor((nmk(i-1)-ss(1))/ds)+1)*dt;
end
for i=1:nt1
lambdasmkt2(i)=lambdasmk2(floor((nmk(i)-ss(1))/ds)+1);
gxmkt2(i)=gxmk2(floor((nmk(i)-ss(1))/ds)+1);
zetant2(i)=zetan2(floor((nmk(i)-ss(1))/ds)+1);
end










subplot(1,3,1)

plot(t1,zetant2,'LineWidth',1.5)
hold on;

xlabel('$t$','interpreter','latex','FontSize',12)

title('A. $\zeta_t$','interpreter','latex','FontSize',12)
axis('square')



subplot(1,3,2)


plot(t1,lambdasmkt2,'LineWidth',1.5)
hold on;


xlabel('$t$','interpreter','latex','FontSize',12)
title('B. $\lambda_t$','interpreter','latex','FontSize',12)

axis('square')
%axis([0, 0.23, 0.5,1])

% zetant1(1)=0.04;
% zetant2(1)=0.02;
% zetant3(1)=0.01;


subplot(1,3,3)

plot(t1,gxmkt2,'LineWidth',1.5)
hold on;

xlabel('$t$','interpreter','latex','FontSize',12)

title('C. ${\bf g}_t$','interpreter','latex','FontSize',12)
axis('square')

%axis([0, 0.23, -0.01,0.02])
print -depsc figure_base_ellg_stateGt5_new
